#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>

#include <QLabel>
#include <QPushButton>
#include <QButtonGroup>
#include <QDir>
#include <QPixmap>
#include <QTransform>
#include <QPropertyAnimation>
#include <QMouseEvent>
#include <QGraphicsOpacityEffect >

#include <QMetaProperty>
class MainWindow : public QMainWindow
{
    Q_OBJECT
    Q_PROPERTY(double rval READ getRval WRITE setRval NOTIFY rvalChanged)
    Q_PROPERTY(double sval READ getSval WRITE setSval NOTIFY svalChanged)
    Q_PROPERTY(double oval READ getOval WRITE setOval NOTIFY ovalChanged)
    Q_PROPERTY(double p_hval READ getP_hval WRITE setP_hval NOTIFY p_hvalChanged)
public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

    QLabel *ml1;
    QPixmap m_pixmap;
    QPixmap *nPixmap;

    QPoint *msclpt;

    int picW = 0;
    int picH = 0;
    int wdWidth = 500;
    int wdHeight = 500;
private:
    double rval=0.0;
    double getRval();
    void setRval(int v1);
    void rvalSetted();

    double sval=0.0;
    double getSval();
    void setSval(int v1);
    void svalSetted();

    double oval=0.0;
    double getOval();
    void setOval(int v1);
    void ovalSetted();

    double p_hval=0.0;
    double getP_hval();
    void setP_hval(double v1);
    void p_hvalSetted();

    QGraphicsOpacityEffect  *mlGraEff;

    QPropertyAnimation *mAni_rotate;
    QPropertyAnimation *mAni_scale;
    QPropertyAnimation *mAni_opacity;
    QPropertyAnimation *mAni_labelPos;
    QPropertyAnimation *mAni_imgCopy;
    bool animationState_R = false;
    bool animationState_S = false;
    bool animationState_O = false;
    bool animationState_LabelMove = false;
    bool animationState_ImgCopy = false;

    void btnR();
    void btnS();
    void btnO();
    void btnLM();
    void btnLGM();

    void iniAnimationOp(QPropertyAnimation *ani,QWidget *obj,QString f_pro,int f_duration,double f_stVal,double f_edVal);
    void iniAnimationOp(QPropertyAnimation *ani,QGraphicsOpacityEffect  *gre,QString f_pro,int f_duration,double f_stVal,double f_edVal);
    void iniAnimationOp(QPropertyAnimation *ani,QWidget *obj,QString f_pro,int f_duration,QPoint sp,QPoint ep);
signals:
    void rvalChanged();
    void svalChanged();
    void ovalChanged();
    void p_hvalChanged();
protected:
    void mousePressEvent(QMouseEvent *event) override;
};
#endif // MAINWINDOW_H
